<html>
<head><meta charset="utf-8"><title>cold · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html">cold</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="148369007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369007">(Nov 26 2018 at 14:10)</a>:</h4>
<p>does anyone know where <code>#[cold]</code> has any effect?</p>



<a name="148369015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369015">(Nov 26 2018 at 14:10)</a>:</h4>
<p>e.g. does it have any effect on match arms?</p>



<a name="148369605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369605">(Nov 26 2018 at 14:20)</a>:</h4>
<p>I bet <span class="user-mention" data-user-id="132920">@gnzlbg</span> has ideas.</p>



<a name="148369697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369697">(Nov 26 2018 at 14:22)</a>:</h4>
<p>/me shoulda just stayed on Discord ;)</p>



<a name="148369707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369707">(Nov 26 2018 at 14:22)</a>:</h4>
<p>There's a lot of scattered info in <a href="https://github.com/rust-lang/rust/issues/26179" target="_blank" title="https://github.com/rust-lang/rust/issues/26179">https://github.com/rust-lang/rust/issues/26179</a></p>



<a name="148369739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148369739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148369739">(Nov 26 2018 at 14:23)</a>:</h4>
<p>e.g.</p>
<blockquote>
<p>We could perhaps just allow <code>#[cold]</code> and/or <code>#[inline(never)]</code> on blocks/statements instead of just functions:</p>
</blockquote>



<a name="148370531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148370531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148370531">(Nov 26 2018 at 14:34)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> reading that issue I think the conclusion is "no"</p>



<a name="148370581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148370581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148370581">(Nov 26 2018 at 14:34)</a>:</h4>
<p>I'm thinking about writing an RFC re. allowing arbitrary attributes on patterns</p>



<a name="148375139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375139">(Nov 26 2018 at 15:38)</a>:</h4>
<p>cold is a function attribute that makes the function use llvm cold calling convention IIRC</p>



<a name="148375140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375140">(Nov 26 2018 at 15:38)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@Mazdak Farrokhzad</span> you might want to check in the LangRef about what exactly that means</p>



<a name="148375141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375141">(Nov 26 2018 at 15:38)</a>:</h4>
<p><a href="https://llvm.org/docs/LangRef.html#calling-conventions" target="_blank" title="https://llvm.org/docs/LangRef.html#calling-conventions">https://llvm.org/docs/LangRef.html#calling-conventions</a></p>
<blockquote>
<p>“coldcc” - The cold calling convention<br>
This calling convention attempts to make code in the caller as efficient as possible under the assumption that the call is not commonly executed. As such, these calls often preserve all registers so that the call does not break any live ranges in the caller side. This calling convention does not support varargs and requires the prototype of all callees to exactly match the prototype of the function definition. Furthermore the inliner doesn’t consider such function calls for inlining.</p>
</blockquote>



<a name="148375142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375142">(Nov 26 2018 at 15:38)</a>:</h4>
<blockquote>
<p>e.g. does it have any effect on match arms? </p>
</blockquote>
<p>AFAIK its a function attribute, so you can't use it anywhere else</p>



<a name="148375266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375266">(Nov 26 2018 at 15:40)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> it is syntactically accepted atm on match arms</p>



<a name="148375334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375334">(Nov 26 2018 at 15:41)</a>:</h4>
<p>weird, that's probably a bug, have you checked what it does ? it might just do nothing. . .</p>



<a name="148375368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375368">(Nov 26 2018 at 15:41)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span> nope; I also think it does nothing but I didnt check</p>



<a name="148375458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375458">(Nov 26 2018 at 15:42)</a>:</h4>
<p>just check then :P some of the old attributes are implemented as "if this is a function then do something else do nothing"</p>



<a name="148375489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375489">(Nov 26 2018 at 15:43)</a>:</h4>
<blockquote>
<p>syntactically accepted </p>
</blockquote>
<p>See also <a href="https://github.com/rust-lang/rust/issues/54044" target="_blank" title="https://github.com/rust-lang/rust/issues/54044">https://github.com/rust-lang/rust/issues/54044</a>:</p>
<blockquote>
<p>A lot of attributes (most of them?) are not validated in any way, neither locations, nor syntax.</p>
</blockquote>



<a name="148375510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375510">(Nov 26 2018 at 15:43)</a>:</h4>
<p>there have been some issues with attributes error messages in the past because they don't check whether they can be used or not</p>



<a name="148375575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375575">(Nov 26 2018 at 15:44)</a>:</h4>
<p>as in, many attributes could only be used in structs or fns or top level, and back then, those were the only place were you could use attributes so checking wasn't "super" necessary</p>



<a name="148375584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375584">(Nov 26 2018 at 15:44)</a>:</h4>
<p>now that you can use attributes on expressions, blocks, etc..</p>



<a name="148375629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375629">(Nov 26 2018 at 15:45)</a>:</h4>
<p>a lot of attributes could be better</p>



<a name="148375645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375645">(Nov 26 2018 at 15:45)</a>:</h4>
<p><span class="user-mention" data-user-id="132920">@gnzlbg</span>  you cant use attrs on exprs</p>



<a name="148375651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375651">(Nov 26 2018 at 15:45)</a>:</h4>
<p>not arbitrary ones at least</p>



<a name="148375658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375658">(Nov 26 2018 at 15:45)</a>:</h4>
<p>on nightly you can</p>



<a name="148375668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375668">(Nov 26 2018 at 15:45)</a>:</h4>
<p>IIRC</p>



<a name="148375715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375715">(Nov 26 2018 at 15:46)</a>:</h4>
<p>ye, sure, <code>stmt_expr_attributes</code></p>



<a name="148375718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375718">(Nov 26 2018 at 15:46)</a>:</h4>
<p>or on statements ?</p>



<a name="148375729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375729">(Nov 26 2018 at 15:46)</a>:</h4>
<p>on stable you can on stmts</p>



<a name="148375738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375738">(Nov 26 2018 at 15:46)</a>:</h4>
<p>ah yes that one is the one I meant</p>



<a name="148375777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148375777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148375777">(Nov 26 2018 at 15:47)</a>:</h4>
<p>if <code>#[cold]</code> works on stable on match arms, that's probably an accidental stabilization, and can be fixed</p>



<a name="148383623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148383623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148383623">(Nov 26 2018 at 17:38)</a>:</h4>
<blockquote>
<p>if #[cold] works on stable on match arms, that's probably an accidental stabilization</p>
</blockquote>
<p>For most built-in attributes neither location, nor passed tokens are validated, so if you put an arbitrary built-in attribute in a completely nonsensical location it will likely be accepted on stable.</p>



<a name="148636549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636549">(Nov 27 2018 at 13:11)</a>:</h4>
<p>See also "Implement attributes for branch weight" <a href="https://github.com/rust-lang/rust/issues/11092" target="_blank" title="https://github.com/rust-lang/rust/issues/11092">#11092</a></p>



<a name="148636692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636692">(Nov 27 2018 at 13:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  saw that one; seems like a nice thing to allow?</p>



<a name="148636746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636746">(Nov 27 2018 at 13:15)</a>:</h4>
<p>maybe; I guess we should look at whether the UI offered by the <code>likely</code>/<code>unlikely</code> intrinsics (<a href="https://github.com/rust-lang/rust/issues/36181" target="_blank" title="https://github.com/rust-lang/rust/issues/36181">#36181</a>) is insufficient?</p>



<a name="148636775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636775">(Nov 27 2018 at 13:15)</a>:</h4>
<p>At least, their addition was the justification for closing issue <a href="https://github.com/rust-lang/rust/issues/11092" target="_blank" title="https://github.com/rust-lang/rust/issues/11092">#11092</a></p>



<a name="148636841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636841">(Nov 27 2018 at 13:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> It's so far out of my area of expertise that I hope "we" doesn't include me ;)</p>



<a name="148636878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636878">(Nov 27 2018 at 13:17)</a>:</h4>
<p>heh; doesn't participating in discussion of color of a bikeshed immediately qualify one for participation in the actual painting of said bikeshed? <span class="emoji emoji-1f609" title="wink">:wink:</span></p>



<a name="148636995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148636995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148636995">(Nov 27 2018 at 13:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  hihi ;) I was really mostly interested in the notion of extending attributes to patterns, i.e. <code>A(x) | #[foo] B(x)</code></p>



<a name="148637025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637025">(Nov 27 2018 at 13:19)</a>:</h4>
<p>i see, and <code>#[cold]</code> was one of the hypothetical justifications you were considering?</p>



<a name="148637034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637034">(Nov 27 2018 at 13:19)</a>:</h4>
<p>yeah</p>



<a name="148637035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637035">(Nov 27 2018 at 13:19)</a>:</h4>
<p>I would imagine <code>#[cfg(...)]</code> alone would suffice as justification, no?</p>



<a name="148637093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637093">(Nov 27 2018 at 13:20)</a>:</h4>
<p>or is the counter-argument somehow that one should always put <code>#[cfg(..)]</code> on arms, not patterns? (seems like a silly claim to me...)</p>



<a name="148637098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637098">(Nov 27 2018 at 13:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> with the semantics that <code>A(x) | #[cfg(foo)] B(x)</code>  would remove <code>B(x)</code> if <code>foo</code> wasn't active?</p>



<a name="148637101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637101">(Nov 27 2018 at 13:20)</a>:</h4>
<p>Right</p>



<a name="148637130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637130">(Nov 27 2018 at 13:21)</a>:</h4>
<p>(do we allow a trailing <code>|</code> ? think it was proposed but I forget the conclusion. We probably don't.)</p>



<a name="148637142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637142">(Nov 27 2018 at 13:21)</a>:</h4>
<p>yeah that makes sense even if the motivation is perhaps not as robust as I'd like</p>



<a name="148637146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637146">(Nov 27 2018 at 13:21)</a>:</h4>
<p>we allow leading |</p>



<a name="148637161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637161">(Nov 27 2018 at 13:21)</a>:</h4>
<p>right but that's not the interesting case here.</p>



<a name="148637206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637206">(Nov 27 2018 at 13:22)</a>:</h4>
<p>I mean, its no problem even if we <em>don't</em> allow trailing <code>|</code></p>



<a name="148637213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637213">(Nov 27 2018 at 13:22)</a>:</h4>
<p>the parser can deal with it.</p>



<a name="148637214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637214">(Nov 27 2018 at 13:22)</a>:</h4>
<p>I have wanted trailing <code>|</code> sometimes... seems to work better with our usual style to have the <code>|</code> at the end of the line</p>



<a name="148637248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637248">(Nov 27 2018 at 13:22)</a>:</h4>
<p><code>#[cfg(foo) A(x) | B(x) =&gt;</code> already attaches to the arm, so you need to write <code>(#[cfg(foo) A(x)) | B(x) =&gt;</code> for the other interpretation</p>



<a name="148637263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637263">(Nov 27 2018 at 13:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I wouldn't be against trailing | personally</p>



<a name="148637271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637271">(Nov 27 2018 at 13:23)</a>:</h4>
<p>it was tangentially discussed on <a href="https://github.com/rust-lang/rfcs/pull/1925" target="_blank" title="https://github.com/rust-lang/rfcs/pull/1925">https://github.com/rust-lang/rfcs/pull/1925</a></p>



<a name="148637334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637334">(Nov 27 2018 at 13:24)</a>:</h4>
<p>yeah; that wasn't a very fun RFC experience so a redo might not be great for social reasons</p>



<a name="148637403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637403">(Nov 27 2018 at 13:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  I'm of the general opinion that almost all syntactic categories should permit attributes on them so the match-arm-only argument is silly to me as well</p>



<a name="148637422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637422">(Nov 27 2018 at 13:25)</a>:</h4>
<p>lordy I'm even the one who posted <a href="https://github.com/rust-lang/rfcs/pull/1925#issuecomment-297851933" target="_blank" title="https://github.com/rust-lang/rfcs/pull/1925#issuecomment-297851933"><code>@rfcbot concern trailing-vert</code></a></p>



<a name="148637425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637425">(Nov 27 2018 at 13:25)</a>:</h4>
<p>Ha.</p>



<a name="148637489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637489">(Nov 27 2018 at 13:26)</a>:</h4>
<p>I should have just kept my mouth shut</p>



<a name="148637507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637507">(Nov 27 2018 at 13:26)</a>:</h4>
<p>(I posted my concern in the name of keeping everyone aware of what was going on, while I personally had no problem with trailing vert... I think...)</p>



<a name="148637628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637628">(Nov 27 2018 at 13:28)</a>:</h4>
<p>hehe; well, that's a sorta nice thing to do</p>



<a name="148637641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637641">(Nov 27 2018 at 13:29)</a>:</h4>
<p>I'm being somewhat facetious when I say "I should have kept my mouth shut"</p>



<a name="148637645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637645">(Nov 27 2018 at 13:29)</a>:</h4>
<p>I wouldn't want to "win" via such suberfuge</p>



<a name="148637651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637651">(Nov 27 2018 at 13:29)</a>:</h4>
<p>at least not on a minor point like this <span class="emoji emoji-1f609" title="wink">:wink:</span></p>



<a name="148637660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637660">(Nov 27 2018 at 13:29)</a>:</h4>
<p>(I've really derailed this thread; that's enough about trailing vert)</p>



<a name="148637661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148637661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148637661">(Nov 27 2018 at 13:29)</a>:</h4>
<blockquote>
<p>at least not on a minor point like this </p>
</blockquote>
<p>Save it for the big occasions ^.^</p>



<a name="148640434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640434">(Nov 27 2018 at 14:20)</a>:</h4>
<p>intrinsics are definitely not an insufficient API</p>



<a name="148640437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640437">(Nov 27 2018 at 14:21)</a>:</h4>
<p>for starters, binary weights are not binary</p>



<a name="148640462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640462">(Nov 27 2018 at 14:21)</a>:</h4>
<p>and for matches you are likely to want almost arbitrary weight distributions</p>



<a name="148640571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640571">(Nov 27 2018 at 14:23)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">match</span><span class="w"> </span><span class="n">expr</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[likely = 3]</span><span class="w"></span>
<span class="w">    </span><span class="n">pat</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">expr</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">pat</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">expr</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[likely = 2]</span><span class="w"></span>
<span class="w">    </span><span class="n">pat</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">expr</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>does seem like an ergonomic way to deal with this</p>



<a name="148640656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640656">(Nov 27 2018 at 14:24)</a>:</h4>
<p>where you have <code>#[likely = &lt;const_context&gt;]</code></p>



<a name="148640665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640665">(Nov 27 2018 at 14:24)</a>:</h4>
<p>the only "UI" that I think works for this is:</p>
<div class="codehilite"><pre><span></span><span class="k">match</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="n">pattern</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cp">#![weight=alot]</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="w">     </span><span class="n">pattern2</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cp">#![weight=nottoomuch]</span><span class="w"> </span><span class="p">},</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">if</span><span class="w"> </span><span class="n">somecondition</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cp">#![weight=alot]</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">othercondition</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="cp">#![weight=slightlyless]</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="cp">#![weight=howaboutnegative]</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>with exact format of attribute being a colour of your favourite shed.</p>



<a name="148640699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640699">(Nov 27 2018 at 14:24)</a>:</h4>
<p>Note that branch weights are applicable to all sorts of control flow.</p>



<a name="148640713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640713">(Nov 27 2018 at 14:25)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  that seems the same thing as I wrote? (just with a renamed attribute)</p>



<a name="148640748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640748">(Nov 27 2018 at 14:25)</a>:</h4>
<p>No, your attributes are applied to a match branch, while in my case they are applied to expression itself.</p>



<a name="148640760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640760">(Nov 27 2018 at 14:25)</a>:</h4>
<p>oh</p>



<a name="148640766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640766">(Nov 27 2018 at 14:25)</a>:</h4>
<p>not even match branch, its pattern.</p>



<a name="148640816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640816">(Nov 27 2018 at 14:26)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  it's applied to the match arm</p>



<a name="148640819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640819">(Nov 27 2018 at 14:26)</a>:</h4>
<p>not the pattern</p>



<a name="148640859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640859">(Nov 27 2018 at 14:27)</a>:</h4>
<p>hmmm...</p>



<a name="148640868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640868">(Nov 27 2018 at 14:27)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  so why apply the attribute to the expression rather than the pattern?</p>



<a name="148640877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640877">(Nov 27 2018 at 14:27)</a>:</h4>
<p>because consistency with other control flow structures.</p>



<a name="148640945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640945">(Nov 27 2018 at 14:28)</a>:</h4>
<p>with <code>if let</code> your example would end up being <code>if let #[likely] pat = expr { }</code> which is super different compared to <code>if expr {}</code>… where’d you even put an attribute on an <code>if</code>?</p>



<a name="148640954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640954">(Nov 27 2018 at 14:28)</a>:</h4>
<p>when I think about this intuitively I want to say what the likelihood of the pattern being a match is</p>



<a name="148640956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148640956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148640956">(Nov 27 2018 at 14:28)</a>:</h4>
<p>it has no pattern/match arm</p>



<a name="148641066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641066">(Nov 27 2018 at 14:30)</a>:</h4>
<p>ostensibly <code>if #[likely] expr { .. } else { ... }</code> annotates that the <code>if</code> branch is likely as opposed to the <code>else</code> branch</p>



<a name="148641100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641100">(Nov 27 2018 at 14:31)</a>:</h4>
<p>but muh consistency…</p>



<a name="148641120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641120">(Nov 27 2018 at 14:31)</a>:</h4>
<p>also you cannot annotate <code>else</code> anymore <span class="emoji emoji-1f642" title="slight smile">:slight_smile:</span></p>



<a name="148641122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641122">(Nov 27 2018 at 14:31)</a>:</h4>
<p>i think the highest order bits I'm taking away from this conversation are that 1. <em>neither</em> <code>#[cold]</code> attribute <em>nor</em> the current <code>likely(EXPR)</code>/<code>unlikely(EXPR)</code> intrinistics are sufficiently general-purpose, and 2. an attribute <em>is</em> likely the be the right answer here, rather than some (new) intrinstic?</p>



<a name="148641126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641126">(Nov 27 2018 at 14:31)</a>:</h4>
<p>yeah it's not great consistency; but I do find <code>#[likely] pat =&gt; expr,</code> more intuitive personally</p>



<a name="148641178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641178">(Nov 27 2018 at 14:32)</a>:</h4>
<p>I wouldn’t mind allowing that as a sugar for <code>pat =&gt; #[likely] expr</code> <span class="emoji emoji-1f642" title="slight smile">:slight_smile:</span></p>



<a name="148641184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641184">(Nov 27 2018 at 14:32)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> oh, we do have <code>#[likely]</code>?</p>



<a name="148641190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641190">(Nov 27 2018 at 14:32)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  fine by me <span class="emoji emoji-1f642" title="slight smile">:slight_smile:</span></p>



<a name="148641192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641192">(Nov 27 2018 at 14:32)</a>:</h4>
<p>we do have a <code>#[cold]</code>for functions, IIRC</p>



<a name="148641194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641194">(Nov 27 2018 at 14:32)</a>:</h4>
<p>not for branches.</p>



<a name="148641198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641198">(Nov 27 2018 at 14:32)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@Mazdak Farrokhzad</span> no, but we have <code>likely(..)</code>, right? That's  <a href="https://github.com/rust-lang/rust/issues/36181" target="_blank" title="https://github.com/rust-lang/rust/issues/36181">#36181</a></p>



<a name="148641208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641208">(Nov 27 2018 at 14:33)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  ye it just works syntactically on branches at least but that's probably a bug per above discussion</p>



<a name="148641228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641228">(Nov 27 2018 at 14:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  oh... right; you said intrinsics :P -- I think your 1-2 points are good</p>



<a name="148641240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641240">(Nov 27 2018 at 14:33)</a>:</h4>
<blockquote>
<p>2. an attribute <em>is</em> likely the be the right answer here, rather than some (new) intrinstic?</p>
</blockquote>
<p>I firmly believe that some sort of an attribute is the right design here.</p>



<a name="148641298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641298">(Nov 27 2018 at 14:34)</a>:</h4>
<p>I think that's the most important takeaway for <span class="user-mention" data-user-id="126931">@Mazdak Farrokhzad</span> , right?</p>



<a name="148641307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641307">(Nov 27 2018 at 14:34)</a>:</h4>
<p>yes</p>



<a name="148641332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641332">(Nov 27 2018 at 14:35)</a>:</h4>
<p>(though I guess <span class="user-mention" data-user-id="123586">@nagisa</span> may or may not agree with the subsequent claim that this motivates attributes on patterns)</p>



<a name="148641403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641403">(Nov 27 2018 at 14:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I was sorta quietly complaining about unstable expr_stmt_attributes so that this feature could get unblocked <span class="emoji emoji-1f642" title="slight smile">:slight_smile:</span></p>



<a name="148641428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641428">(Nov 27 2018 at 14:36)</a>:</h4>
<p>I don’t mind attributes on patterns/arms/etc.</p>



<a name="148641447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641447">(Nov 27 2018 at 14:36)</a>:</h4>
<p><span class="emoji emoji-1f44d" title="thumbs up">:thumbs_up:</span></p>



<a name="148641448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641448">(Nov 27 2018 at 14:37)</a>:</h4>
<p>I can’t immediately think of any syntax ambiguities there.</p>



<a name="148641453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641453">(Nov 27 2018 at 14:37)</a>:</h4>
<p>they probably don't motivate that as <code>#[likely = weight]</code> being sugar on an arm is not the same as on a pattern</p>



<a name="148641472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641472">(Nov 27 2018 at 14:37)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> iirc <code>stmt_expr_attributes</code> were blocked on precedence disagreements</p>



<a name="148641473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641473">(Nov 27 2018 at 14:37)</a>:</h4>
<blockquote>
<p>I can’t immediately think of any syntax ambiguities there.</p>
</blockquote>
<p>well apart from the obvious <code>#[attr] pat =&gt; expr</code></p>



<a name="148641489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641489">(Nov 27 2018 at 14:37)</a>:</h4>
<p>I think that ambiguity is easily motivated (and also stable... =P )</p>



<a name="148641555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641555">(Nov 27 2018 at 14:38)</a>:</h4>
<p>I personally prefer the precedence in Huon's original RFC</p>



<a name="148641566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641566">(Nov 27 2018 at 14:38)</a>:</h4>
<p>i.e. <code>#[attr] a + b</code> associates as <code>(#[attr] a) + b</code></p>



<a name="148641583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641583">(Nov 27 2018 at 14:38)</a>:</h4>
<p>In any case I agree with <span class="user-mention" data-user-id="126931">@Mazdak Farrokhzad</span> 's earlier point of just saying that you'd disambiguate via <code>(#[attr_on_pat] pat) =&gt; expr</code></p>



<a name="148641605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641605">(Nov 27 2018 at 14:39)</a>:</h4>
<p>...but <code>#[attr] x.f(y)</code> associates as <code>#[attr] (x.f(y))</code></p>



<a name="148641609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641609">(Nov 27 2018 at 14:39)</a>:</h4>
<p>(or maybe that should be <code>(#![attr_on_pat] pat) =&gt; expr</code>)</p>



<a name="148641613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641613">(Nov 27 2018 at 14:39)</a>:</h4>
<p>I don’t see a difference. There’s no semantic difference between applying attribute to a whole arm of a match or just its pattern (provided the implementation is appropriately adjusted)</p>



<a name="148641618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641618">(Nov 27 2018 at 14:39)</a>:</h4>
<p>I… think.</p>



<a name="148641621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641621">(Nov 27 2018 at 14:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  seems equivalent?</p>



<a name="148641670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641670">(Nov 27 2018 at 14:40)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@Mazdak Farrokhzad</span> depends on how significant the parens are or could be</p>



<a name="148641672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641672">(Nov 27 2018 at 14:40)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span>  well for arbitrary proc macros they get different inputs</p>



<a name="148641683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641683">(Nov 27 2018 at 14:40)</a>:</h4>
<p>Ah… okay.</p>



<a name="148641713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641713">(Nov 27 2018 at 14:40)</a>:</h4>
<p>i.e. <code>(#![attr] foo)</code> == <code>#[attr] (foo)</code>, right?</p>



<a name="148641734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641734">(Nov 27 2018 at 14:41)</a>:</h4>
<blockquote>
<p>i.e. <code>(#![attr] foo)</code> == <code>#[attr] (foo)</code>, right?</p>
</blockquote>
<p>yes.</p>



<a name="148641736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641736">(Nov 27 2018 at 14:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  oh, right; yes, that seems correct</p>



<a name="148641844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641844">(Nov 27 2018 at 14:42)</a>:</h4>
<p>I've proposed extending attributes to types and such for now, &lt;<a href="https://github.com/rust-lang/rfcs/pull/2602" target="_blank" title="https://github.com/rust-lang/rfcs/pull/2602">https://github.com/rust-lang/rfcs/pull/2602</a>&gt;</p>



<a name="148641861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641861">(Nov 27 2018 at 14:42)</a>:</h4>
<p>you mean type (formal) params I assume?</p>



<a name="148641873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641873">(Nov 27 2018 at 14:43)</a>:</h4>
<p>oh and actual args I see</p>



<a name="148641954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641954">(Nov 27 2018 at 14:44)</a>:</h4>
<p>(and components of where clauses et cetera ad infinitum)</p>



<a name="148641957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641957">(Nov 27 2018 at 14:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span>  we already permit attrs on type variables</p>



<a name="148641967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641967">(Nov 27 2018 at 14:44)</a>:</h4>
<p>yeah I know, I added it</p>



<a name="148641968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641968">(Nov 27 2018 at 14:44)</a>:</h4>
<p>and lifetime variables</p>



<a name="148641973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641973">(Nov 27 2018 at 14:44)</a>:</h4>
<p>for <code>#[may_dangle]</code></p>



<a name="148641984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641984">(Nov 27 2018 at 14:44)</a>:</h4>
<p>(may it never rest in peace)</p>



<a name="148641999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148641999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148641999">(Nov 27 2018 at 14:44)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> ;) I recall asking about why it was unstable and then you stabilized it?</p>



<a name="148642023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148642023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148642023">(Nov 27 2018 at 14:45)</a>:</h4>
<p>I don't remember at this point the stabilization step</p>



<a name="148642027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148642027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148642027">(Nov 27 2018 at 14:45)</a>:</h4>
<p>certainly <code>#[may_dangle]</code> should not be stable</p>



<a name="148642036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/148642036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#148642036">(Nov 27 2018 at 14:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> not may_dangle, but arbitrary attrs on generic params</p>



<a name="152450631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/152450631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#152450631">(Dec 24 2018 at 02:39)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> Interesting from ghc-proposals: <a href="https://github.com/ghc-proposals/ghc-proposals/pull/182" target="_blank" title="https://github.com/ghc-proposals/ghc-proposals/pull/182">https://github.com/ghc-proposals/ghc-proposals/pull/182</a></p>



<a name="152467438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/152467438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#152467438">(Dec 24 2018 at 12:12)</a>:</h4>
<p>This is fairly close to what I’m thinking for our attributes</p>



<a name="152467482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/152467482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#152467482">(Dec 24 2018 at 12:12)</a>:</h4>
<p>only their proposal centers around annotating the constructors rather than branches</p>



<a name="159072378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159072378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159072378">(Feb 21 2019 at 14:41)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> if we use a weight API, where each weight is in range <code>[0.0, 1.0]</code>, and we require that all weights add to <code>1.0</code>, and require using it on all branches, then this API would basically be expressing the probability that a branch has of being taken.</p>



<a name="159072478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159072478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159072478">(Feb 21 2019 at 14:42)</a>:</h4>
<p>We can even not require adding it on al branches, by adding the provided probabilities into sum, and splitting <code>(1.0 - sum)</code> over the remaining branches (meaning they are all equally probable of being taken). If <code>sum == 0.0</code>, we can warn that those branches are dead code (they have a zero probability of being taken).</p>



<a name="159072549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159072549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159072549">(Feb 21 2019 at 14:43)</a>:</h4>
<p>That feels like a manual way of providing PGO-information on branches</p>



<a name="159072934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159072934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159072934">(Feb 21 2019 at 14:48)</a>:</h4>
<p>we can also not require them summing up to 1 and just normalize ourselves, for the programmer's convenience</p>



<a name="159083044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159083044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159083044">(Feb 21 2019 at 16:39)</a>:</h4>
<p>If we go that way, I think that having all branches have a weight of <code>1.0</code> and then higher than 1.0 would mean "more likely to be taken" and less = “less likely”. Easy to normalise and easy to figure out what to do in the default case, for branches that have no metadata provided.</p>



<a name="159090462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/cold/near/159090462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/cold.html#159090462">(Feb 21 2019 at 18:12)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span>  I think that's a good idea, <code>#[likely = 3]</code> seems much more easy to deal with and it is what e.g. <code>proptest_derive</code> does, <a href="https://altsysrq.github.io/proptest-book/proptest-derive/modifiers.html#weight" target="_blank" title="https://altsysrq.github.io/proptest-book/proptest-derive/modifiers.html#weight">https://altsysrq.github.io/proptest-book/proptest-derive/modifiers.html#weight</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>